local fenmei = fk.CreateSkill {
  name = "lingling__fenmei",
}

Fk:loadTranslationTable{
  ["lingling__fenmei"] = "奋袂",
  [":lingling__fenmei"] = "当你受到伤害后，你可以将两张牌当【杀】使用，若未造成伤害，你摸三张牌。",

  ["#lingling__fenmei-use"] = "奋袂：你可以将两张牌当【杀】使用",
}

fenmei:addEffect(fk.Damaged, {
  anim_type = "offensive",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(fenmei.name) and
      #player:getHandlyIds() + #player:getCardIds("e") > 1 and
      player:canUse(Fk:cloneCard("slash"), { bypass_times = true })
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local use = room:askToUseVirtualCard(player, {
      name = "slash",
      skill_name = fenmei.name,
      prompt = "#lingling__fenmei-use",
      cancelable = true,
      card_filter = {
        n = 2,
      },
      skip = true,
    })
    if use then
      event:setCostData(self, {extra_data = use})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local use = table.simpleClone(event:getCostData(self).extra_data)
    room:useCard(use)
    if not (use and use.damageDealt) and not player.dead then
      player:drawCards(3, fenmei.name)
    end
  end,
})

return fenmei
